package com.xiaocz.hblsubstitutedriving.activities.activity.dialog;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.widget.AppCompatImageView;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.uuzuche.lib_zxing.activity.CodeUtils;
import com.xiaocz.common.utils.AccountManagers;
import com.xiaocz.common.widgets.CircleImageView;
import com.xiaocz.hblsubstitutedriving.R;
import com.xiaocz.hblsubstitutedriving.base.NativeActivity;
import com.xiaocz.hblsubstitutedriving.model.UserInfo;
import com.xiaocz.hblsubstitutedriving.utils.Constants;
import com.xiaocz.hblsubstitutedriving.utils.ImageUtils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import butterknife.BindView;

/**
 * Time:2019/11/7
 * Created by xiaocz
 * Describe 电子工牌
 */
public class DialogBadgeActivity extends NativeActivity {

    @BindView(R.id.layout_base)
    LinearLayout layout;
    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.tv_jl)
    TextView tvJl;
    @BindView(R.id.tv_gh)
    TextView tvGh;
    @BindView(R.id.iv_head_portrait)
    CircleImageView circleImageView;

    public static void show(Context context) {
        Intent intent = new Intent(context, DialogBadgeActivity.class);
        context.startActivity(intent);
    }

    @Override
    protected int getLayoutSourceId() {
        return R.layout.dialog_badge;
    }


    @Override
    protected void initData() {
        super.initData();
        UserInfo info = new Gson().fromJson(AccountManagers.getAccount(), UserInfo.class);
        if(info!=null){
            tvName.setText(String.valueOf("姓名："+info.getTruename()));
            tvJl.setText(String.valueOf("驾龄："+info.getDrive_age()+"年"));
            tvGh.setText(String.valueOf("工号："+info.getJobnum()));
                            Glide.with(mContext)
                                    .load(info.getHeadPictureUrl()).apply(Constants.getOptions())
                                    .into(circleImageView);
        }
    }
}
